@extends('layouts.admin')

@section('title', 'Package_Detail')

@section('content')
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #f8f8f8;
            color: #333;
            line-height: 1.6;
        }

        .container {
            display: flex;
            min-height: 100vh;
        }

        .sidebar {
            width: 250px;
            background-color: #ffffff;
            padding: 20px 0;
            box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        }

        .sidebar h1 {
            color: rgb(255, 187, 1);
            padding: 0 20px 20px;
            border-bottom: 1px solid #e0e0e0;
            margin-bottom: 20px;
            font-size: 22px;
        }

        .sidebar ul {
            list-style: none;
        }

        .sidebar li {
            padding: 12px 20px;
            color: #000000;
        }

        .sidebar li a {
            text-decoration: none;
            color: inherit;
            display: block;
        }

        .sidebar li:hover {
            background-color: #f5f5f5;
        }

        .sidebar li.active {

            color: #000000;

        }

        .main-content {
            flex: 1;
            padding: 25px;
            background-color: #f8f8f8;
        }

        .package-detail-section {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            margin-bottom: 25px;
            overflow: hidden;
            border: 1px solid #e0e0e0;
        }

        .package-header {
            background-color: rgb(255, 187, 1);
            color: white;
            padding: 12px 25px;
            font-weight: bold;
            font-size: 16px;
        }

        .package-content {
            padding: 20px;
        }

        .package-section {
            margin-bottom: 20px;
        }

        .package-section h3 {
            font-size: 16px;
            margin-bottom: 10px;
            color: #555;
            border-bottom: 1px solid #eee;
            padding-bottom: 5px;
        }

        .package-item {
            margin-left: 20px;
            margin-bottom: 8px;
        }

        .package-item strong {
            display: inline-block;
            width: 185px;
        }

        .info-item {
            margin-left: 20px;
            margin-bottom: 8px;
            font-style: italic;
            color: #666;
        }

        .data-section {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px dashed #ccc;
        }
        .sidebar li.Start {
            background-color: rgb(255 255 255);
            color: #000000;
            border-left: 4px solid rgb(255 255 255);
            font-weight: 700;
        }
        .flow_chart{
            width: 100%;
            height: 30px;


            border-top: rgb(129, 133, 200) 6px solid;
            display: flex;
            justify-content: space-around;
        }

        .Add-Courier-Button {
            background-color: rgb(29, 134, 255);
            color: white;
            border: none;
            float: left;
            margin: 12px 29px;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
        }

    </style>

    <div class="sidebar">
        <h1>Campus Fxpress</h1>
        <ul>
            <li><a href="{{ route('admin.dashboard') }}">Dashboard</a></li>
            <li><a href="{{ route('admin.Package_List') }}">Package List</a></li>
            <li><a href="{{ route('admin.Campus_List') }}">Campus List</a></li>
            <li class="Start"><a href="#">Start Management</a></li>
            <li><a href="{{ route('admin.Courier_List') }}">Contact List</a></li>
            <li><a href="{{ route('admin.Trucker_List') }}">Trucker List</a></li>
        </ul>
    </div>

    <div class="main-content">
        <div class="package-detail-section">
            <div class="package-header">Package Detail</div>
            <div class="package-content">
                <div class="package-section">
{{--                    <h3>Package List</h3>--}}
                    <div class="package-item">
                        <strong>Tracking Number:</strong>
                        <span>{{$package->number}}</span>
                    </div>
                    <div class="package-item">
                        <strong>States:</strong>
                        <span>   @if($package->state == 0)
                                Pending pickup
                            @elseif($package->state == 1)
                                Picked up
                            @elseif($package->state == 2)
                                Pending transit
                            @elseif($package->state == 3)
                                In transit
                            @elseif($package->state == 4)
                                Pending delivery
                            @elseif($package->state == 5)
                                Delivering
                            @else
                                Signed
                            @endif</span>
                    </div>
                </div>

                <div class="package-section">
                    <h3></h3>
{{--                    <div class="info-item"> </div>--}}
                    <div class="package-item">
                        <strong>Sender info:</strong>

                     <p>name: {{$package->sender_name}}</p>
                        <p>phone: {{$package->sender_phone}}</p>
                        <p>address: {{$package->sender_address}}</p>
                    </div>

                    <div class="package-item">
                        <strong>recipient info:</strong>

                        <p>name: {{$package->recipient_name}}</p>
                        <p>phone: {{$package->recipient_phone}}</p>
                        <p>address: {{$package->recipient_address}}</p>
                    </div>
                </div>

                <div class="package-section">
                    <h3></h3>

                    <div class="package-item">
                        <strong>Plaque Counter Info:</strong>

                        <p>name: {{$package->delivery->first_name . ' ' . $package->delivery->last_name }}</p>
                        <p>phone: {{$package->delivery->email}}</p>
                        <p>address: {{$package->delivery->phone}}</p>
                    </div>

                    <div class="package-item">
                        <strong>Deltvery Courier info:</strong>

                        <p>name: {{$package->dispatch->first_name . ' ' . $package->dispatch->last_name }}</p>
                        <p>phone: {{$package->dispatch->email}}</p>
                        <p>address: {{$package->dispatch->phone}}</p>
                    </div>
                </div>

                <div class="package-section">
                    <h3></h3>
                    <div class="package-item">
                        <strong>Progress of the package</strong>
                    </div>

                    <div class="flow_chart">

                        @if($package->state == 0)
                            <div style="color: rgb(117, 173, 255)">Pending pickup</div>
                            <div>Picked up</div>
                            <div>Pending transit</div>
                            <div>In transit</div>
                            <div>Pending delivery</div>
                            <div>Delivering</div>
                            <div>Signed</div>
                        @elseif($package->state == 1)
                            <div>Pending pickup</div>
                            <div style="color: rgb(117, 173, 255)">Picked up</div>
                            <div>Pending transit</div>
                            <div>In transit</div>
                            <div>Pending delivery</div>
                            <div>Delivering</div>
                            <div>Signed</div>
                        @elseif($package->state == 2)
                            <div>Pending pickup</div>
                            <div>Picked up</div>
                            <div style="color: rgb(117, 173, 255)">Pending transit</div>
                            <div>In transit</div>
                            <div>Pending delivery</div>
                            <div>Delivering</div>
                            <div>Signed</div>
                        @elseif($package->state == 3)
                            <div>Pending pickup</div>
                            <div>Picked up</div>
                            <div>Pending transit</div>
                            <div style="color: rgb(117, 173, 255)">In transit</div>
                            <div>Pending delivery</div>
                            <div>Delivering</div>
                            <div>Signed</div>
                        @elseif($package->state == 4)
                            <div>Pending pickup</div>
                            <div>Picked up</div>
                            <div>Pending transit</div>
                            <div>In transit</div>
                            <div style="color: rgb(117, 173, 255)">Pending delivery</div>
                            <div>Delivering</div>
                            <div>Signed</div>
                        @elseif($package->state == 5)
                            <div>Pending pickup</div>
                            <div>Picked up</div>
                            <div>Pending transit</div>
                            <div>In transit</div>
                            <div>Pending delivery</div>
                            <div style="color: rgb(117, 173, 255)">Delivering</div>
                            <div>Signed</div>
                        @else
                            <div>Pending pickup</div>
                            <div>Picked up</div>
                            <div>Pending transit</div>
                            <div>In transit</div>
                            <div>Pending delivery</div>
                            <div>Delivering</div>
                            <div style="color: rgb(117, 173, 255);">Signed</div>
                        @endif


                    </div>

                </div>

                <div class="data-section">
                    <a href="{{ route('admin.Package_List') }}"><button class="Add-Courier-Button">back</button></a>
                </div>
            </div>
        </div>
    </div>
@endsection
